package cn.edu.zut.qixiang.controller;

import cn.edu.zut.qixiang.service.WeatherMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 86178
 */
@RestController
@RequestMapping("/map")
public class WeatherMapController {

    @Autowired
    private WeatherMapService weatherMapService;


    @GetMapping("/weatherData")
    public ResponseEntity<Map<String, Object>> getWeatherMapData(
            @RequestParam String date) {
        Map<String, Object> result = weatherMapService.getWeatherMapData(date);
        return ResponseEntity.ok(result);
    }

    @GetMapping("/districtInfo")
    public ResponseEntity<Map<String, Object>> getDistrictWeatherInfo(
            @RequestParam String district,
            @RequestParam String date) {
        Map<String, Object> result = weatherMapService.getDistrictWeatherInfo(district, date);
        return ResponseEntity.ok(result);
    }
}